package com.xls.base.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xls.base.model.Employee;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author xls
 * @since 2021-03-23
 */
public interface EmployeeMapper extends BaseMapper<Employee> {

    @Select("SELECT\n" +
            "\tid,\n" +
            "\temployee_number,\n" +
            "\tname,\n" +
            "\tgender,\n" +
            "\t(SELECT name FROM building WHERE id = building) AS building,\n" +
            "\tphone,\n" +
            "\tgmt_create,\n" +
            "\tgmt_modified,\n" +
            "\tis_deleted AS deleted\n" +
            "FROM\n" +
            "\temployee\n" +
            "\t${ew.customSqlSegment}")
    Page<Employee> getEmployeePage(Page<Employee> page, @Param(Constants.WRAPPER) QueryWrapper<Employee> wrapper);

}
